#!/usr/bin/evn python
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   文件名称 :     models
   文件功能描述 :   功能描述
   创建人 :       小钟同学
   创建时间 :          2022/2/9
-------------------------------------------------
   修改描述-2022/2/9:
-------------------------------------------------
"""
import datetime

from infirmary_admin_src.infirmary_smart_admin.infirmary_models.admin_dbhelper import database, session_scope, session_scope2
from playhouse.postgres_ext import *



class UnknownField(object):
    def __init__(self, *_, **__): pass

class BaseModel(Model):
    class Meta:
        database = database

class SysDept(BaseModel):
    create_time = DateTimeField(null=True)
    department_id = IntegerField(constraints=[SQL("DEFAULT 0")], primary_key=True)
    manager_id = IntegerField(null=True)
    name = TextField(constraints=[SQL("DEFAULT ''::text")])
    department_code = TextField(constraints=[SQL("DEFAULT ''::text")])
    parent_id = IntegerField(constraints=[SQL("DEFAULT 0")], index=True, null=True)
    sort = IntegerField(constraints=[SQL("DEFAULT 999")], null=True)
    update_time = DateTimeField(null=True)

    class Meta:
        table_name = 'sys_dept'

class SysDictKey(BaseModel):
    create_time = DateTimeField(null=True)
    deleted_flag = IntegerField(null=True)
    dict_key_id = AutoField()
    key_code = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    key_name = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    remark = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    update_time = DateTimeField(null=True)

    class Meta:
        table_name = 'sys_dict_key'

class SysDictValue(BaseModel):
    create_time = DateTimeField(null=True)
    deleted_flag = IntegerField(null=True)
    dict_key_id = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    dict_value_id = AutoField()
    remark = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    sort = IntegerField(null=True)
    update_time = DateTimeField(null=True)
    value_code = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    value_name = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)

    class Meta:
        table_name = 'sys_dict_value'

class SysEmployee(BaseModel):
    actual_name = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    administrator_flag = IntegerField(null=True)
    create_time = DateTimeField(null=True)
    deleted_flag = IntegerField(null=True)
    department_id = IntegerField(null=True)
    disabled_flag = IntegerField(null=True)
    employee_id = IntegerField(constraints=[SQL("DEFAULT 0")], primary_key=True)
    gender = IntegerField(null=True)
    login_name = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    login_pwd = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    phone = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    remark = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    update_time = DateTimeField(null=True)

    class Meta:
        table_name = 'sys_employee'

class SysMenu(BaseModel):
    api_perms = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    cache_flag = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
    component = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    context_menu_id = IntegerField(null=True)
    create_time = DateTimeField(null=True)
    create_user_id = IntegerField(null=True)
    deleted_flag = IntegerField(null=True)
    disabled_flag = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
    frame_flag = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
    frame_url = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    icon = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    menu_id = IntegerField(constraints=[SQL("DEFAULT 0")], primary_key=True)
    menu_name = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    menu_type = IntegerField(null=True)
    parent_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
    path = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    perms_type = IntegerField(null=True)
    sort = IntegerField(null=True)
    update_time = DateTimeField(null=True)
    update_user_id = IntegerField(constraints=[SQL("DEFAULT 0")], null=True)
    visible_flag = IntegerField(constraints=[SQL("DEFAULT 1")], null=True)
    web_perms = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)

    class Meta:
        table_name = 'sys_menu'

class SysRole(BaseModel):
    create_time = DateTimeField(null=True)
    remark = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    role_id = IntegerField(constraints=[SQL("DEFAULT 0")], primary_key=True)
    role_name = TextField(constraints=[SQL("DEFAULT ''::text")], null=True)
    update_time = DateTimeField(null=True)

    class Meta:
        table_name = 'sys_role'

class SysRoleDataScpoe(BaseModel):
    create_time = DateTimeField(null=True)
    data_scope_type = IntegerField(null=True)
    role_id = IntegerField(null=True)
    update_time = DateTimeField(null=True)
    view_type = IntegerField(null=True)

    class Meta:
        table_name = 'sys_role_data_scpoe'

class SysRoleEmployee(BaseModel):
    create_time = DateTimeField(null=True)
    employee_id = IntegerField(null=True)
    role_id = IntegerField(null=True)
    update_time = DateTimeField(null=True)

    class Meta:
        table_name = 'sys_role_employee'

class SysRoleMenu(BaseModel):
    create_time = DateTimeField(null=True)
    menu_id = IntegerField(index=True, null=True)
    role_id = IntegerField(index=True, null=True)
    role_menu_id = IntegerField(constraints=[SQL("DEFAULT 0")], primary_key=True)
    update_time = DateTimeField(null=True)

    class Meta:
        table_name = 'sys_role_menu'

